#define _CRT_SECURE_NO_WARNINGS  1
#include<stdio.h>
#include<math.h>
int main()
{
	int i;
	for (i = 0; i < 100001; i++)
	{
		int j=1;
		double sum = 0;
		while (i / (int)pow(10, j))
			j++;
		int n = i;
		while (n != 0)
		{
			sum += pow(n % 10, j);
			n /= 10;
		}
		if (sum == i)
			printf("%d ", i);
	}
	return 0;
}